<?php
    session_start();
    require_once ("incl/functions/menu.php");
    require_once ("incl/connectDB.php");

    $menu = new menu;
    $db = new connectDB;

    if (!isset($_SESSION['language']) || $_SESSION['language'] == 1)
    {
        $_SESSION['language'] = "en";
        // this sets the default language, when another language hasn't been set already.
        // there is also a bug that causes the session variable to be 1, untill that is
        // solved, the OR operator remains
    }
    include("incl/language/" . $_SESSION['language'] . "/lang.php");

    if (!isset ($_GET["page"]))
    {	$page = "main";	}
    else
    {	$page = $_GET["page"];	}
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
        <title>
            Portofolio Leander molegraaf
        </title>
        <link rel="stylesheet" type="text/css" href="incl/CSS/main.css" />
        <link rel="stylesheet" href="incl/CSS/lightbox.css" type="text/css" media="screen" />
        <script type="text/javascript" src="incl/JS/showHide.js"> </script>
        <script type="text/javascript" src="incl/JS/prototype.js"></script>
        <script type="text/javascript" src="incl/JS/scriptaculous.js?load=effects,builder"></script>
        <script type="text/javascript" src="incl/JS/lightbox.js"></script>
    </head>

    <body>
        <div>
            <div>
                <a href="index.php">
                    <img src= "images/button.png" id="subbar_logo" alt="terug naar beginpagina" />
                </a>
                <div id="center_text">
                    <img src="images/name.png" alt="Leander Molegraaf - 3d &amp; programming"/>
                </div>
            </div>
            <!-- end sub bar -->

            <div class="language">
                <a href="switchlang.php">
                    <img src="images/switchETD.png" class="language" alt="switch &lt; br / &lt; language" />
                </a>
            </div>
            <!-- switch language icon -->
            <table id="menuDiv">
                <?php
                    $menu->makeMenu();
                ?>
            </table>


            <div id="programlinks">
                <!-- List of programs that i user(Maya,UDK,Source, etc.)-->
                <table id='extraTable'>
                    <?php
                        $menu->makeExtraMenu();
                    ?>
                </table>
            </div>
            <!-- List with links to sites like my linkedin accout -->
            
        </div>
        <!-- end sitelinks window -->

        <div id="autocont">
            <hr />
            <?php 
                if(!$row = mysql_fetch_array(mysql_query("SELECT link FROM links WHERE name='" . $page . "'"))){
                    $row = mysql_fetch_array(mysql_query("SELECT link FROM menu_subhoofdstuk WHERE name='". $page . "'"));
                }
                include($row[0] . ".php"); 
            ?>
        </div>
    </body>
</html>
